JAVA = java
JAVA_ARGS = -classpath classes

JAVAC = javac
JAVAC_ARGS = -sourcepath src -d classes

all : classes/TestVectorHash.class classes/TestLinkedHash.class classes/TestLinkedTree.class classes/StudentMap.class classes/TestNumberOutput.class

classes/RandomIterator.class : src/RandomIterator.java
	$(JAVAC) $(JAVAC_ARGS) $<

classes/RandomIterable.class : src/RandomIterable.java classes/RandomIterator.class
	$(JAVAC) $(JAVAC_ARGS) $<

classes/TestVectorHash.class : src/TestVectorHash.java classes/RandomIterable.class
	$(JAVAC) $(JAVAC_ARGS) $<

classes/TestLinkedHash.class : src/TestLinkedHash.java classes/RandomIterable.class
	$(JAVAC) $(JAVAC_ARGS) $<

classes/TestLinkedTree.class : src/TestLinkedTree.java classes/RandomIterable.class
	$(JAVAC) $(JAVAC_ARGS) $<

classes/StudentMap.class : src/StudentMap.java
	$(JAVAC) $(JAVAC_ARGS) $<

classes/TestNumberOutput.class : src/TestNumberOutput.java
	$(JAVAC) $(JAVAC_ARGS) $<

runlists : all
	$(JAVA) $(JAVA_ARGS) TestVectorHash
	$(JAVA) $(JAVA_ARGS) TestLinkedHash
	$(JAVA) $(JAVA_ARGS) TestLinkedTree

runoutput : all
	$(JAVA) $(JAVA_ARGS) StudentMap
	$(JAVA) $(JAVA_ARGS) TestNumberOutput

run : runlists runoutput

clean :
	$(RM) classes/*.class *.txt *.db
